package com.hopes.bizz.risk.transfer.converter;

import com.hopes.bizz.risk.control.entity.RiskControlMeasureEntity;
import com.hopes.bizz.risk.transfer.bean.dto.RiskControlMeasuresDto;
import com.hopes.bizz.risk.transfer.converter.expression.RiskControlMeasuresExp;
import org.mapstruct.BeanMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper(uses = {RiskControlMeasuresExp.class})
public interface RiskControlMeasuresConverter {

    RiskControlMeasuresConverter INSTANCE = Mappers.getMapper(RiskControlMeasuresConverter.class);

    @Mapping(target = "uid", source = "id")
    @Mapping(target = "delFlag", source = "deleted", defaultValue = "0")
    @Mapping(target = "createTime", source = "createDate", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "createBy", source = "createBy")
    @Mapping(target = "updateTime", source = "updateDate", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "updateBy", source = "updateBy")
    @Mapping(target = "controlType", source = "dataSrc", qualifiedByName = "controlType")
    @Mapping(target = "riskMeasureDesc", source = "riskMeasureDesc")
    @Mapping(target = "checkContent", source = "troubleshootContent")
    @Mapping(target = "classify1", source = "classify1")
    @Mapping(target = "classify2", source = "classify2")
    @Mapping(target = "classify3", source = "classify3")
    @BeanMapping(ignoreByDefault = true)
    RiskControlMeasureEntity toEntity(RiskControlMeasuresDto riskControlMeasuresDto);
}
